# D115 Siemes Tags
from django import template
from django.conf import settings
from django.utils.translation import ugettext_lazy as _
from django.template.defaultfilters import linebreaksbr
from django.contrib.sites.models import Site
from d115.siemes.models import SiteSetting

register = template.Library()

@register.simple_tag
def put_setting(sname):
    output = ""
    try:
        output = SiteSetting.objects.filter(site=Site.objects.get_current(), name=sname)[0]
        if output.use_breaks:
            output = linebreaksbr(output.value)
        else:
            output = output.value
    except:
        pass
    return output
